﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CoolCode.Web.Mvc.UI.Grid
{
	public class ToolbarButton : IToolbarButton
	{
		public string Name { get; private set; }
		public string Css { get; private set; }
		public Func<string> ClickHandler { get; private set; }
		public string Html { get; private set; }
		public string PartialViewName { get; private set; }

		public ToolbarButton()
		{
			ClickHandler = () => string.Empty;
		}

		#region IToolbarButton Members

		public IToolbarButton Named(string value)
		{
			Name = value;
			return this;
		}

		IToolbarButton IToolbarButton.Css(string value)
		{
			Css = value;
			return this;
		}

		public IToolbarButton OnClick(Func<string> func)
		{
			ClickHandler = func;
			return this;
		}

		void IToolbarButton.Html(string html)
		{
			Html = html;
		}

		void IToolbarButton.Partial(string partialViewName)
		{
			PartialViewName = partialViewName;
		}

		#endregion
	}
}
